package edu.zzuli.common;

/**
 * Created by Chen-D.W on 2018/1/7.
 */
public class Ticket implements Runnable {

    private static int count;

    public Ticket() {
        count = 0;
    }

    @Override
    public  void run() {
        synchronized(this) {
            for (int i = 0; i < 5; i++) {
                try {
                    System.out.println(Thread.currentThread().getName() + ":" + (count++));
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

//    public int getCount() {
//        return count;
//    }
}
